Serial Peripheral Interface (SPI) is a synchronous serial communication interface for sending and receiving data. Typically, the SPI is used for communication between a host microcontroller (“master”) and peripherals (“servants”). The SPI bus may have four signals, for example, a serial clock signal (“SCLK”), a chip select signal (“CSN”), a serial data input signal (“SDI”), and a serial data output signal (“SDO”). The serial clock signal provides synchronization between the master and the servants, however, only a selected servant device receives the chip select signal (e.g., an active LOW signal), which enables only the selected servant device to accept and respond to the SPI command (“frame”). Input and output data are synchronized and transferred simultaneously on both data lines (e.g., SDI and SDO).
Generally, the master initiates the communication by changing the signal on the CSN line to a LOW state. A period of time after the signal on the CSN line is a LOW state, the master provides clock pulse signals on the SCLK line to the servant devices. With each SPI clock cycle the master sends bits on the SDI line and receives bits on the SDO, which are typically eight or sixteen bit words.